unit RclSAX;

interface

uses
  SAX, SAXKW;

type
  TSAXReaderFactory = class
  public
    class function GetReader: IXMLReader;
  end;

  TInputSourceHelp = class(TObject)
  public
    class function CreateInputSource(S: string): IInputSource;
    class function CreatStreamInputSource(S: string): IInputSource;
  end;     

implementation

uses
  Classes;

class function TSAXReaderFactory.GetReader: IXMLReader;
begin
  Result := SAX.GetSAXVendor.XMLReader;
end;

class function TInputSourceHelp.CreateInputSource(S: string): IInputSource;
begin
  Result := TInputSource.Create(S);
end;

class function TInputSourceHelp.CreatStreamInputSource(S: string): IInputSource;
var
  stream: TMemoryStream;
begin
  stream := TMemoryStream.Create;
  stream.Write(s[1], Length(S));
  Result := TStreamInputSource.Create(stream, soOwned);
end;

end.
